package com.aaa.product.service.impl;

import com.aaa.product.dao.TbOrdInfMapper;
import com.aaa.product.entity.TbOrdInf;
import com.aaa.product.service.TbOrdInfService;
import com.aaa.product.dao.TbOrdInfMapper;
import com.aaa.product.entity.TbOrdInf;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TbOrdInfServiceImpl extends ServiceImpl<TbOrdInfMapper, TbOrdInf> implements TbOrdInfService {

    @Resource
    TbOrdInfMapper tbOrdInfMapper;
    @Resource
    RedisTemplate redisTemplate;

    public TbOrdInf findById(String tid) {
        return tbOrdInfMapper.selectById(tid);
    }

    public List<TbOrdInf> listBySname(String shippingName) {
        QueryWrapper<TbOrdInf> travelsQueryWrapper = new QueryWrapper<>();
        travelsQueryWrapper.like("shipping_name", shippingName);
        return this.list(travelsQueryWrapper);
    }

    public List<TbOrdInf> listDesc() {
        QueryWrapper<TbOrdInf> tbPrdInfoQueryWrapper = new QueryWrapper<>();
        tbPrdInfoQueryWrapper.orderByDesc("update_date");
        return this.list(tbPrdInfoQueryWrapper);
    }

    public List<TbOrdInf> findByTbid(String accountId,Integer status,String lableName) {
        return tbOrdInfMapper.findByTbid(accountId,status,lableName);
    }

    @Override
    public TbOrdInf findByOid(String oid) {
        return tbOrdInfMapper.findByOid(oid);
    }
}

